/*******************************************************************************
 * Copyright (c) 2011-11-13 @author <a href="mailto:iffiff1@hotmail.com">Tyler Chen</a>.
 * All rights reserved.
 *
 * Contributors:
 *     <a href="mailto:iffiff1@hotmail.com">Tyler Chen</a> - initial API and implementation
 ******************************************************************************/
package com.redhat.auth.ejb.impl;

import java.util.List;

import com.dayatang.querychannel.support.Page;

/**
 * @author <a href="mailto:iffiff1@hotmail.com">Tyler Chen</a> 
 * @since 2011-11-13
 */
public final class PageUtil {

	private PageUtil() {
	}

	public static <T> Page<T> toPage(Page<?> page, List<T> list) {
		if (page == null) {
			return null;
		}
		return new Page<T>(Page.getStartOfPage(Long.valueOf(
				page.getCurrentPageNo()).intValue(), page.getPageSize()), page
				.getTotalCount(), page.getPageSize(), list);
	}
}
